import React, {Component} from 'react';
import { StatusBar } from 'react-native';
import {
    Scene,
    Router,
    Stack,
    Lightbox, Drawer
} from 'react-native-router-flux';

import LoginPage from './components/pages/login/index';
import LoginOut  from './components/pages/login/loginOut';
import IndexPage from './components/pages/index/index';
import NewIndexPage from './components/pages/index/newIndex';
import ReadyCash from './components/pages/index/readyCash';
import SuccessPage from './components/pages/index/success';
import BalanceOrderPage from './components/pages/index/balanceOrder';
import OrderPage from './components/pages/index/order';
import CashPage from './components/pages/index/cash';
import CashMoneyPage from './components/pages/aftersale/cashmoney';
import CashExchange from './components/pages/aftersale/cashExchange';
import BalanceCashPage from './components/pages/index/balanceCash';
import ReturnPage from './components/pages/index/return';
import CashReturnSuccess from './components/pages/aftersale/cashReturnSuccess';
import ReturnSuccess from './components/pages/aftersale/returnSuccess';
import ApplyPages from './components/pages/aftersale/apply';
import StockPage from './components/pages/index/stock';
import MemberPage from './components/pages/member/index';
import MemberDetailPage from './components/pages/member/detail';
import BalanceSuccessPage from './components/pages/index/balancrSuccess';
import ProductDataPage from './components/pages/index/ProductData';
import ProductDataHistoryPage from './components/pages/index/ProductDataHistory';
import InventoryPage from './components/pages/index/inventory';
import InventoryHistoryPage from './components/pages/index/inventoryHistory';
import InventoryHistoryDetailPage from './components/pages/index/inventoryHistoryDetail';
import TransferPage from './components/pages/index/transfer';
import TransferHistoryPage from './components/pages/index/transferHistory';
import TransferHistoryDetailPage from './components/pages/index/transferHistoryDetail';
import ProductDataHistoryDetailPage from './components/pages/index/ProductDataHistoryDetail';
import CommonIconButton from './components/widget/CommonIconButton';
import styles from './style/global'

import {screenWidth, drawerWidth} from "./style/global";


const getRouter = () => {
  return (
      <Router>
          <Stack key="root">
              {/*会员管理详情页面*/}
              <Scene key="MemberDetailPage" component={MemberDetailPage}
                     showLabel={false}
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     title="会员管理"
                     renderRightButton={() => <CommonIconButton />}
              />
              {/*会员管理列表页面*/}
              <Scene key="MemberPage" component={MemberPage}
                     showLabel={false}
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     title="会员管理"
                     renderRightButton={() => <CommonIconButton />}
              />
              {/*库存查询页面*/}
              <Scene key="StockPage" component={StockPage}
                     showLabel={false}
                     hideNavBar

              />
              {/*采购入库页面*/}
              <Scene key="ProductDataPage" component={ProductDataPage}
                     showLabel={false}
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     title="采购入库"
                     renderRightButton={() => <CommonIconButton />}
              />
              {/*采购入库历史记录页面*/}
              <Scene key="ProductDataHistoryPage" component={ProductDataHistoryPage}
                     showLabel={false}
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     title="历史记录"
                     renderRightButton={() => <CommonIconButton />}
              />
              {/*采购入库历史记录详情页面*/}
              <Scene key="ProductDataHistoryDetailPage" component={ProductDataHistoryDetailPage}
                     showLabel={false}
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     title="详情"
                     renderRightButton={() => <CommonIconButton />}
              />
              {/*库存盘点页面*/}
              <Scene key="InventoryPage" component={InventoryPage}
                     showLabel={false}
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     title="库存盘点"
                     renderRightButton={() => <CommonIconButton />}
              />
              {/*库存盘点历史记录页面*/}
              <Scene key="InventoryHistoryPage" component={InventoryHistoryPage}
                     showLabel={false}
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     title="库存盘点历史记录"
                     renderRightButton={() => <CommonIconButton />}
              />
              {/*库存盘点历史记录详情页面*/}
              <Scene key="InventoryHistoryDetailPage" component={InventoryHistoryDetailPage}
                     showLabel={false}
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     title="库存盘点历史记录详情"
                     renderRightButton={() => <CommonIconButton />}
              />
              {/*库存调拨页面*/}
              <Scene key="TransferPage" component={TransferPage}
                     showLabel={false}
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     title="库存调拨"
                     renderRightButton={() => <CommonIconButton />}
              />
              {/*库存调拨历史记录页面*/}
              <Scene key="TransferHistoryPage" component={TransferHistoryPage}
                     showLabel={false}
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     title="库存调拨历史记录"
                     renderRightButton={() => <CommonIconButton />}
              />
              {/*库存调拨历史记录详情页面*/}
              <Scene key="TransferHistoryDetailPage" component={TransferHistoryDetailPage}
                     showLabel={false}
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     title="库存调拨历史记录详情"
                     renderRightButton={() => <CommonIconButton />}
              />

              {/*购买收银页面*/}
              <Scene key="CashPage" component={CashPage}
                     showLabel={false}
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     title="收款"
                     renderRightButton={() => <CommonIconButton />}
                     />
              {/*充值收银页面*/}
              <Scene key="BalanceCashPage" component={BalanceCashPage}
                     showLabel={false}
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     title="收款"
                     renderRightButton={() => <CommonIconButton />}
              />

              <Scene key="returnPage" component={ReturnPage}
                     showLabel={false}
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     title="退换货"
                     renderRightButton={() => <CommonIconButton />}
              />

              {/*余额订单列表页面*/}
              <Scene key="BalanceOrderPage" component={BalanceOrderPage}
                     showLabel={false}
                     title='销售单据'
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     renderRightButton={() => <CommonIconButton />}
                     />
              {/*购买商品列表页面*/}
              <Scene key="OrderPage" component={OrderPage}
                     showLabel={false}
                     title='销售单据'
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     renderRightButton={() => <CommonIconButton />}
              />
              {/*购买商品成功页面*/}
              <Scene key="SuccessPage" component={SuccessPage}
                     showLabel={false}
                     title='收款'
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     renderRightButton={() => <CommonIconButton />}
                     />

              {/*余额充值成功页面*/}
              <Scene key="BalanceSuccessPage" component={BalanceSuccessPage}
                     showLabel={false}
                     title='收款'
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     renderRightButton={() => <CommonIconButton />}
              />
              {/*首页*/}
              <Scene key="IndexPage" component={IndexPage}
                     showLabel={false}
                     hideNavBar/>
              {/*旧首页*/}
              <Scene key="NewIndexPage" component={NewIndexPage}
                     showLabel={false}
                     hideNavBar/>
              {/*登录页面*/}
              <Scene key="LoginPage" component={LoginPage}
                     showLabel={false}
                     initial={true}
                     hideNavBar/>
              {/*交接班页面*/}
              <Scene key="LoginOut" component={LoginOut}
                     showLabel={false}
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     title='交接班'
                     renderRightButton={() => <CommonIconButton />}
              />
              {/*现金收支页面*/}
              <Scene key="ReadyCash" component={ReadyCash}
                     showLabel={false}
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     title='现金收支'
                     renderRightButton={() => <CommonIconButton />}
              />

              {/*退换货退钱页面（第一，二种情况）*/}
              <Scene key="CashMoneyPage" component={CashMoneyPage}
                     showLabel={false}
                     title="收款"
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     renderRightButton={() => <CommonIconButton />}
              />
              {/*退换货收钱页面（第三种情况）*/}
              <Scene key="CashExchange" component={CashExchange}
                     showLabel={false}
                     title="收款"
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     renderRightButton={() => <CommonIconButton />}
              />
              {/*退换货退钱成功页面（第一，二种情况）*/}
              <Scene key="ReturnSuccess" component={ReturnSuccess}
                     showLabel={false}
                     title="收款"

                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     renderRightButton={() => <CommonIconButton />}
              />
              {/*退换货收钱成功页面（第三种情况）*/}
              <Scene key="CashReturnSuccess" component={CashReturnSuccess}
                     showLabel={false}
                     title="收款"

                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     renderRightButton={() => <CommonIconButton />}
              />
              {/*退换货申请页面*/}
              <Scene key="ApplyPages" component={ApplyPages}
                     showLabel={false}
                     title="退换货"
                     navigationBarStyle={styles.navigationBar}
                     titleStyle={styles.titleTextStyle}
                     backButtonTintColor='#ffffff'
                     renderRightButton={() => <CommonIconButton />}
              />
          </Stack>
      </Router>

  )
};
export default getRouter;